package com.steakliu.sun.registry.api;

import com.steakliu.sun.common.meta.ServiceMeta;
import com.steakliu.sun.constant.RegistryConstant;
import com.steakliu.sun.spi.annotation.SPI;

/**
 * 功能说明： 注册中心接口
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-07  21:47
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
@SPI(RegistryConstant.NACOS)
public interface RegistryService {

    void init(RegistryConfig registryConfig) throws Exception;
    /**
     * service register
     * @param serviceMeta
     */
    void register(ServiceMeta serviceMeta) throws Exception;
    /**
     * cancel register
     * @param serviceMeta
     */
    void unregister(ServiceMeta serviceMeta) throws Exception;
    /**
     * 服务发现
     * @param serviceName 服务名
     * @param directConnections 直接地址
     * @param loadBalance 负载均衡类型
     * @return
     */
    ServiceMeta discovery(String serviceName, String directConnections, String loadBalance) throws Exception;

    /**
     * 监控服务
     * @throws Exception
     */
    void monitor(String serviceName) throws Exception;
    /**
     * 服务销毁
     */
    void destroy() throws Exception;
}
